package com.scs.application.modules.dept.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.scs.application.core.mapper.IBaseMapper;
import com.scs.application.modules.base.entity.MatrUnit;
import com.scs.application.modules.dept.entity.ApplyItem;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 科室请领单明细 Mapper 接口
 * </p>
 *
 */
public interface ApplyItemMapper extends IBaseMapper<ApplyItem> {

    /**
     *  该科室默认最多请领单位
     * @param deptId
     * @param materialId
     * @return
     */
    MatrUnit getApplyMaxUnit(@Param("deptId") String deptId, @Param("materialId") String materialId, @Param("applyType") String applyType, @Param("flagOmoc") String flagOmoc);
    List<ApplyItem> selectListWithoutDisabled(@Param("ew") Wrapper<ApplyItem> queryWrapper);

    /**
     * 查询科室请领单明细下的耗材分类
     */
    @Select("select m.base_type from base_matr m inner join dept_apply_item t on m.id = t.matr_id where t.apply_id = #{applyId} group by m.base_type")
    List<String> getType(@Param("applyId") String applyId);
}
